<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
</head>
<body onload="test()">
<p>This test checks that a long press gesture on a draggable element starts a drag/drop session.</p>
<div id="text">Testing</div>
<div id="dragResult">FAIL</div>
<div id="mouseDownResult">PASS</div>
<div id="draggableDiv" draggable='true'>Drag me</div>
<script>
function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    if (window.internals)
        internals.settings.setTouchDragDropEnabled(true);

    var dragableDiv = document.getElementById("draggableDiv");

    var x = draggableDiv.offsetParent.offsetLeft + draggableDiv.offsetLeft + 4;
    var y = draggableDiv.offsetParent.offsetTop + draggableDiv.offsetTop + draggableDiv.offsetHeight / 2;

    document.ondragstart = function(e) {
      if (e.x == x && e.y == y)
        document.getElementById("dragResult").innerHTML = "PASS";
    };
    document.onmousedown = function() { document.getElementById("mouseDownResult").innerHTML = "FAIL"; };

    if (!window.eventSender)
        return;
    if (eventSender.gestureLongPress) {
        eventSender.gestureLongPress(x, y);
    } else {
        debug("gestureLongPress not implemented by this platform");
        return;
    }
}
</script>
</body>
</html>
